﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SIPO.Library.DataAccess.Transaction;
using System.Configuration;
using System.Data;
using Microsoft.Reporting.WebForms;

public partial class reports_Transaction_rptInvoice : System.Web.UI.Page
{
    private recInvoiceRepo recInvoiceDal = new recInvoiceRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
    private string InvoiceNo = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                if (Context.Request.Params["InvoiceNo"] != null)
                    InvoiceNo = Context.Request.Params["InvoiceNo"].Trim();

                DataTable dt = recInvoiceDal.GetDatatableRptInvoice(InvoiceNo);

                rsViewer.Reset();
                rsViewer.LocalReport.ReportPath = Server.MapPath("~/reportviewer/Transaction/rptInvoiceDetail.rdlc");
                ReportDataSource rds = new ReportDataSource();
                rds.Name = "DataSet1";
                rds.Value = dt;

                rsViewer.LocalReport.DataSources.Clear();
                rsViewer.LocalReport.DataSources.Add(rds);
                rsViewer.LocalReport.Refresh();

            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
            
        }
    }
}